package com.example.mapp;

import com.example.mapp.buildSql.DataInterfaceMappSql;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

@Mapper
public interface DataInterfaceServiceMapp {

    @Select(" select credit_code as maintenanceUnitNum, party_name as maintenanceUnitName,corporation as maintenanceUnitLead, " +
            " telephone as maintenanceUnitLeadIphone,zzdj as maintenanceUnitQualifications,maint_start as maintenanceLevel, "+
            " IFNULL(su.mark,0) as maintenanceUnitScore,IFNULL(pu.popnum,0) as maintenancePersonCount,IFNULL(mp.elenum,0) as elevatorNums "+
            " FROM party p "+
            " LEFT JOIN sys_user su ON p.credit_code = su.user_code "+
            " LEFT JOIN (select party_id as partyId,sum(1) as popnum from party_user GROUP BY party_id) pu  ON p.id = pu.partyId  " +
            " LEFT JOIN (select maintenance_party_id as maintenancePartyId,sum(1) as elenum from elevator where maintenance_party_id is not null GROUP BY maintenance_party_id) mp  ON p.id = mp.maintenancePartyId" +
            " WHERE party_type = '1' and credit_code is not null")
    List<Map<String, Object>> listMaintenancePartyInterface(Map map);


    @SelectProvider(type = DataInterfaceMappSql.class, method = "listMaintenanceRecordsInterface")
    List<Map<String,Object>> listMaintenanceRecordsInterface(Map map);

    @SelectProvider(type = DataInterfaceMappSql.class, method = "listMaintenanceProjectInterface")
    List<Map<String,Object>> listMaintenanceProjectInterface(Map map);
    // 液压
    @SelectProvider(type = DataInterfaceMappSql.class, method = "listMaintenanceProjectInterfaceHydpress")
    List<Map<String,Object>> listMaintenanceProjectInterfaceHydpress(Map map);
    // 自动
    @SelectProvider(type = DataInterfaceMappSql.class, method = "listMaintenanceProjectInterfaceEsCalator")
    List<Map<String,Object>> listMaintenanceProjectInterfaceEsCalator(Map map);
    // 杂物
    @SelectProvider(type = DataInterfaceMappSql.class, method = "listMaintenanceProjectInterfaceDebris")
    List<Map<String,Object>> listMaintenanceProjectInterfaceDebris(Map map);
}
